/* ESP32开发工具样式表 */

/* 自定义样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a202c, #2d3748);
    min-height: 100vh;
}

/* 玻璃拟态效果 */
.glass-effect {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 霓虹文字效果 */
.neon-text {
    text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #0073e6, 0 0 20px #0073e6;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #2d3748;
}

::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* 树形结构样式 */
.tree, .tree ul, .tree li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tree li {
    padding: 5px 0 5px 20px;
    position: relative;
    transition: background-color 0.2s;
}

.tree li:before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 15px;
    height: 1.5em;
    border-left: 1px solid #6b7280;
    border-bottom: 1px solid #6b7280;
}

.tree li:after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 15px;
    height: 100%;
    border-left: 1px solid #6b7280;
}

.tree li:last-child:after {
    display: none;
}

.tree > li:first-child:before {
    border-left: none;
}

.tree > li:first-child:after {
    border-left: none;
}

.tree li:hover {
    background-color: #374151;
    border-radius: 3px;
}

/* 引脚配置面板 */
.pin-config-panel {
    animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.pin-config-overlay {
    animation: overlayAppear 0.3s ease-out;
}

@keyframes overlayAppear {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 连接状态指示器 */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-connected {
    background-color: #10B981;
    box-shadow: 0 0 8px #10B981;
}

.status-disconnected {
    background-color: #9CA3AF;
}

/* 引脚配置样式 */
.pin-item {
    transition: all 0.2s ease;
    cursor: pointer;
}

.pin-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.pin-configured {
    border-color: #8b5cf6;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

/* 代码标签页 */
.tab-btn {
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.tab-btn:hover:not(.active) {
    background: #374151;
}

/* 按钮悬停效果 */
button {
    transition: all 0.2s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 进度条动画 */
.progress-bar {
    transition: width 0.3s ease;
}

/* 卡片悬停效果 */
.bg-gray-800 {
    transition: all 0.3s ease;
}

.bg-gray-800:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* 串口监视器 */
#serial-monitor p {
    margin: 0;
    line-height: 1.4;
}

.serial-message {
    color: #d1d5db;
}

.serial-error {
    color: #f87171;
}

.serial-info {
    color: #60a5fa;
}

.serial-success {
    color: #34d399;
}

.serial-debug {
    color: #c084fc;
}

/* 调试面板样式 */
.device-tab:nth-child(3) {
    /* 调试选项卡特殊样式 */
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
}

.device-tab:nth-child(3).device-tab-active {
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
}

/* 指令模态框 */
#instructions-modal {
    backdrop-filter: blur(5px);
}

#instructions-modal pre {
    background: #1f2937;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
}

/* 滚动条优化 */
#instructions-modal::-webkit-scrollbar {
    width: 6px;
}

#instructions-modal::-webkit-scrollbar-track {
    background: rgba(30, 30, 46, 0.5);
    border-radius: 3px;
}

#instructions-modal::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 3px;
}

/* 响应式设计优化 */
@media (max-width: 1280px) {
    .container {
        padding: 1.5rem;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    #pin-configuration {
        min-height: 180px;
    }
    
    #code-preview {
        max-height: 350px;
    }
}

@media (max-width: 1024px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    #pin-configuration {
        min-height: 150px;
    }
    
    #code-preview {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .grid-cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    #code-preview {
        max-height: 250px;
    }
    
    .p-6 {
        padding: 1rem;
    }
    
    .text-4xl {
        font-size: 2rem;
    }
    
    .text-xl {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    .p-6 {
        padding: 0.75rem;
    }
    
    .py-8 {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    .mb-8 {
        margin-bottom: 1rem;
    }
    
    .space-y-8 > :not([hidden]) ~ :not([hidden]) {
        margin-top: 1rem;
    }
    
    .text-sm {
        font-size: 0.75rem;
    }
    
    .py-2 {
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }
    
    .px-4 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* 代码预览区域优化 */
#code-preview {
    min-height: 250px;
}

#code-preview pre {
    margin: 0;
    border-radius: 0;
    height: 100%;
}

/* 渐变边框效果 */
.border-gradient {
    position: relative;
    border: none;
    background: linear-gradient(135deg, #1f2937, #111827) padding-box,
                linear-gradient(135deg, #4f46e5, #7c3aed) border-box;
    border-width: 2px;
    border-style: solid;
}

/* 功能模块卡片 */
.feature-card {
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* 标题区域 */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

header p {
    font-size: 1.1rem;
    color: #d1d5db;
    max-width: 600px;
    margin: 0 auto;
}

/* 安全提示横幅 */
.bg-yellow-900 {
    background-color: #78350f;
}

.border-yellow-500 {
    border-color: #f59e0b;
}

.text-yellow-300 {
    color: #fcd34d;
}

.text-yellow-500 {
    color: #f59e0b;
}

/* 表单元素 */
select, input {
    background-color: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

select:focus, input:focus {
    outline: none;
    ring: 2px solid #818cf8;
    border-color: #818cf8;
}

/* 模态框 */
.pin-config-overlay {
    z-index: 1000;
}

.pin-config-panel {
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

/* 进度条 */
#flash-progress {
    transition: width 0.3s ease-in-out;
}

/* 底部 */
footer {
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
    padding-top: 1.5rem;
    margin-top: 2rem;
    border-top: 1px solid #374151;
}

/* 设备交互选项卡 */
.device-tab {
    background-color: #374151;
    color: #9ca3af;
    font-weight: 500;
    transition: all 0.2s ease;
}

.device-tab:hover {
    background-color: #4b5563;
    color: #d1d5db;
}

.device-tab.active {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.device-panel {
    transition: all 0.3s ease;
}

.device-panel.hidden {
    display: none;
}

/* WiFi连接面板 */
#wifi-device-info p {
    margin: 0.5rem 0;
}

/* 加载指示器 */
.loading-spinner {
    border-width: 4px;
    border-color: #6366f1;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    width: 3rem;
    height: 3rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 脉冲动画 */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
    }
}

/* 库管理器样式 */
#library-manager-modal {
    backdrop-filter: blur(5px);
}

.library-item {
    transition: all 0.2s ease;
}

.library-item:hover {
    background-color: rgba(55, 65, 81, 0.7);
    transform: translateX(2px);
}

.library-item.active {
    background-color: rgba(102, 126, 234, 0.2);
    border-left: 3px solid #667eea;
}

/* 代码高亮 */
#library-detail pre {
    margin: 0;
    padding: 0;
    background: transparent !important;
}

#library-detail code {
    font-family: 'Fira Code', 'Consolas', monospace;
}

/* 滚动条优化 */
#library-list::-webkit-scrollbar,
#library-detail::-webkit-scrollbar {
    width: 6px;
}

#library-list::-webkit-scrollbar-track,
#library-detail::-webkit-scrollbar-track {
    background: rgba(30, 30, 46, 0.5);
    border-radius: 3px;
}

#library-list::-webkit-scrollbar-thumb,
#library-detail::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 3px;
}

/* 按钮动画 */
.btn-primary, .btn-secondary, .btn-accent {
    position: relative;
    overflow: hidden;
}

.btn-primary:after, .btn-secondary:after, .btn-accent:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.btn-primary:focus:not(:active)::after,
.btn-secondary:focus:not(:active)::after,
.btn-accent:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(50, 50);
        opacity: 0;
    }
}

/* 响应式优化 */
@media (max-width: 1024px) {
    #library-manager-modal .compact-card {
        width: 95%;
        height: 90%;
    }
}

@media (max-width: 768px) {
    #library-manager-modal .compact-card {
        flex-direction: column;
        height: 95%;
    }
    
    #library-manager-modal .compact-card > div:first-child {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    #library-manager-modal .compact-card > div:last-child {
        width: 100%;
    }
    
    /* 移动端库列表项优化 */
    .library-item {
        padding: 0.75rem 0.5rem;
    }
    
    .library-item .text-sm {
        font-size: 0.8rem;
    }
    
    .library-item .text-xs {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .compact-layout {
        padding: 0.5rem;
    }
    
    .compact-card {
        padding: 0.75rem;
    }
    
    .header-text {
        font-size: 1.25rem;
    }
    
    .sub-header {
        font-size: 0.75rem;
    }
    
    /* 库详情页面优化 */
    #library-detail {
        padding: 0.75rem;
    }
    
    #library-detail h2 {
        font-size: 1.25rem;
    }
    
    #library-detail h3 {
        font-size: 1rem;
    }
    
    #library-detail pre {
        font-size: 0.7rem;
    }
    
    /* 按钮文字优化 */
    .btn-text {
        font-size: 0.75rem;
    }
    
    .btn-text i {
        font-size: 0.7rem;
    }
}

/* 按钮悬停效果 */
.btn-hover-effect {
    transition: all 0.3s ease;
}

.btn-hover-effect:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* 卡片悬停效果 */
.card-hover-effect {
    transition: all 0.3s ease;
}

.card-hover-effect:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* 进度条动画 */
@keyframes progress-bar-stripes {
    0% {
        background-position: 1rem 0;
    }
    100% {
        background-position: 0 0;
    }
}

.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

/* 引脚配置模态框样式 */
.pin-configured {
    border-color: #8b5cf6 !important;
    background: rgba(139, 92, 246, 0.1);
}

/* 代码预览区域滚动条样式 */
#codePreview::-webkit-scrollbar {
    width: 8px;
}

#codePreview::-webkit-scrollbar-track {
    background: #2d3748;
}

#codePreview::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

#codePreview::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* 库管理器样式 */
.library-item {
    transition: all 0.2s ease;
}

.library-item:hover {
    background: rgba(79, 70, 229, 0.2);
    transform: translateX(5px);
}

.library-item.selected {
    background: rgba(79, 70, 229, 0.3);
    border-left: 3px solid #4f46e5;
}

/* 调试器样式 */
.debugger-highlight {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
}

/* 交互面板切换样式 */
.interaction-tab {
    cursor: pointer;
    transition: all 0.2s ease;
}

.interaction-tab:hover {
    color: #ffffff !important;
}

.interaction-tab.active {
    color: #60a5fa !important;
    border-color: #60a5fa !important;
}

.interaction-content {
    transition: all 0.3s ease;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .grid-cols-3 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .h-96 {
        height: 24rem;
    }
}

@media (max-width: 768px) {
    .grid-cols-2 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .text-4xl {
        font-size: 2rem;
    }
    
    .p-6 {
        padding: 1rem;
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 模态框样式 */
.modal-overlay {
    background: rgba(0, 0, 0, 0.75);
}

.modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #2d3748;
}

::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #718096;
}
